package org.u2ml.stack.log;
import java.util.logging.Handler;
import java.util.logging.LogManager;
import java.util.logging.Logger;

import javax.annotation.PostConstruct;

import org.slf4j.bridge.SLF4JBridgeHandler;
import org.springframework.stereotype.Component;

@Component
public class LogEngine {
	
	@PostConstruct
	public void init() {
		/* 
		 * Installs SLF4J JUL bridge, to redirect JUL logging to slf4j.
		 * Note that this prevents from using JUL as implementation for slf4j
		 */
		Logger rootLogger = LogManager.getLogManager().getLogger("");
		for (Handler handler : rootLogger.getHandlers()) {
			rootLogger.removeHandler(handler);
		}
		SLF4JBridgeHandler.install();
	}
}
